package exception;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 异常处理机制在IO操作中运用
 */
public class FinallDemo2 {
    public static void main(String[] args) {
        System.out.println("程序开始了....");
        FileOutputStream fos=null;
        try {
                fos=new FileOutputStream("a/c");
                fos.write(2);
            }catch (Exception e){
            System.out.println("出现异常并解决");
        }finally {
            try {
                fos.close();
            } catch (Exception e) {
                System.out.println("出现异常并解决");
            }
        }
        System.out.println("程序结束了....");
    }
}
